package net.slidinglive.utilities.model;

import android.database.Cursor;
import android.provider.ContactsContract;

/**
 * @author Sebastian Hoffmann
 * 
 */
public class Address {

    private String postBox;
    private String street;
    private String city;
    private String region;
    private String postCode;
    private String country;
    private int type;

    public Address() {

    }

    public Address(final Cursor addressCursor) {

        this.setPostBox(addressCursor.getString(addressCursor
                .getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.POBOX)));
        this.setStreet(addressCursor.getString(addressCursor
                .getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.STREET)));
        this.setCity(addressCursor.getString(addressCursor
                .getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.CITY)));
        this.setRegion(addressCursor.getString(addressCursor
                .getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.REGION)));
        this.setPostCode(addressCursor.getString(addressCursor
                .getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE)));
        this.setCountry(addressCursor.getString(addressCursor
                .getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.COUNTRY)));
        this.setType(addressCursor.getInt(addressCursor
                .getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.TYPE)));
    }

    /**
     * @return the postBox
     */
    public String getPostBox() {

        return this.postBox;
    }

    /**
     * @param postBox
     *            the postBox to set
     */
    public void setPostBox(String postBox) {

        this.postBox = postBox;
    }

    /**
     * @return the street
     */
    public String getStreet() {

        return this.street;
    }

    /**
     * @param street
     *            the street to set
     */
    public void setStreet(String street) {

        this.street = street;
    }

    /**
     * @return the city
     */
    public String getCity() {

        return this.city;
    }

    /**
     * @param city
     *            the city to set
     */
    public void setCity(String city) {

        this.city = city;
    }

    /**
     * @return the region
     */
    public String getRegion() {

        return this.region;
    }

    /**
     * @param region
     *            the region to set
     */
    public void setRegion(String region) {

        this.region = region;
    }

    /**
     * @return the postCode
     */
    public String getPostCode() {

        return this.postCode;
    }

    /**
     * @param postCode
     *            the postCode to set
     */
    public void setPostCode(String postCode) {

        this.postCode = postCode;
    }

    /**
     * @return the country
     */
    public String getCountry() {

        return this.country;
    }

    /**
     * @param country
     *            the country to set
     */
    public void setCountry(String country) {

        this.country = country;
    }

    /**
     * @return the type
     */
    public int getType() {

        return this.type;
    }

    /**
     * @param type
     *            the type to set
     */
    public void setType(int type) {

        this.type = type;
    }

    /**
     * @return the resource id of the type label
     */
    public int getTypeLabelResourceId() {

        return ContactsContract.CommonDataKinds.StructuredPostal.getTypeLabelResource(this.getType());
    }
}